<template>
	<view>
		<view class="promoter-list">
			<view class='promoterHeader bg-color'>
				<view class='headerCon acea-row row-between-wrapper'>
					<view class="left">
						<view class='name'>推广人数</view>
						<view><text class='num'>{{sum}}</text>人</view>
					</view>
					<view class='iconfont iconai-connection' style="font-size:120rpx;"></view>
				</view>
			</view>
		</view>

		<view class="item_info" style="font-size:28rpx;padding:20rpx;">
			<view>头像</view>
			<view style="width:30%;text-align:center;">昵称</view>
			<view>时间</view>
		</view>
		<view style="height:101%;">
				<view class="item_info" v-for="item in list" :key="item">
					<image class="head_img" :src="item.avatarUrl"></image>
					<view style="font-size:28rpx;color:#333;" class="nickName">{{item.nickName}}</view>
					<view style="font-size:26rpx;color:#888;">{{$tools.formatTime(item.create_time,'date')}}</view>
				</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				sum:0,
				list:[],
				page:1,
				sumPage:0,
			}
		},
		onLoad() {
			this.getList()
		},
		methods:{
			async getList() {
				let res = await this.$tools.req(this.$urls.spreadList, {
					page: this.page,
				})
				uni.hideLoading()
				if (res.code == 200) {
					if (this.page == 1) {
						this.sum = res.data.sum
						this.list = res.data.list
						this.sumPage = res.data.sumPage
					} else {
						this.list = this.list.concat(res.data.list);
					}
				}
			},
			onReachBottom() {
				if (this.page > this.sumPage) return this.$pub.msg('加载完毕!');
				this.page++;
				uni.showLoading({
					title: '正在加载更多...'
				});
				this.getList();
			},
		}
	}
</script>

<style lang="scss" scoped>
	.promoter-list {
		.nav {
			background-color: #fff;
			height: 86rpx;
			line-height: 86rpx;
			font-size: 28rpx;
			color: #282828;
			border-bottom: 1rpx solid #eee;

			.item {
				.on {
					border-bottom: 5rpx solid $themeColor;
					color: $themeColor;
				}
			}
		}

		.search {
			width: 100%;
			background-color: #fff;
			height: 86rpx;
			padding: 0 30rpx;
			box-sizing: border-box;

			.input {
				width: 630rpx;
				height: 60rpx;
				border-radius: 50rpx;
				background-color: #f5f5f5;
				text-align: center;
				position: relative;

				input {
					height: 100%;
					font-size: 26rpx;
					width: 620rpx;
					text-align: center;
				}

				.placeholder {
					color: #bbb;
				}

				.iconfont {
					position: absolute;
					right: 28rpx;
					color: #999;
					font-size: 28rpx;
					top: 50%;
					transform: translateY(-50%);
				}
			}

			.iconfont {
				font-size: 45rpx;
				color: #515151;
			}
		}

		.list {
			margin-top: 12rpx;

			.sortNav {
				background-color: #fff;
				height: 76rpx;
				border-bottom: 1rpx solid #eee;
				color: #333;
				font-size: 28rpx;

				.sortItem {
					text-align: center;
					flex: 1;

					image {
						width: 24rpx;
						height: 24rpx;
						margin-left: 6rpx;
						vertical-align: -3rpx;
					}
				}
			}

			.item {
				background-color: #fff;
				border-bottom: 1rpx solid #eee;
				height: 152rpx;
				padding: 0 30rpx 0 20rpx;
				font-size: 24rpx;
				color: #666;

				.picTxt {
					width: 440rpx;

					.pictrue {
						width: 106rpx;
						height: 106rpx;
						border-radius: 50%;

						image {
							width: 100%;
							height: 100%;
							border-radius: 50%;
							border: 3rpx solid #fff;
							box-shadow: 0 0 10rpx #aaa;
							box-sizing: border-box;
						}
					}

					.text {
						width: 304rpx;
						font-size: 24rpx;
						color: #666;

						.name {
							font-size: 28rpx;
							color: #333;
							margin-bottom: 13rpx;
						}
					}
				}

				.right {
					width: 240rpx;
					text-align: right;
					font-size: 22rpx;
					color: #333;
				}
			}

		}


	}

	view {
		box-sizing: border-box;
	}

	.bg-color {
		background-color: $themeColor !important;
	}

	.promoterHeader {
		width: 100%;
		height: 220rpx;

		.headerCon {
			width: 100%;
			height: 100%;
			padding: 0 88rpx 0 55rpx;
			box-sizing: border-box;
			font-size: 28rpx;
			color: #fff;
			.left{
				width: 80%;
			}
		}

		.name {
			margin-bottom: 10rpx;
		}

		.num {
			font-size: 50rpx;
		}
	}

	.acea-row {
		display: flex;
		flex-wrap: wrap;

		.row-between-wrapper {
			align-items: center;
			justify-content: space-between;
		}
	}

	.head_img {
		width: 80rpx;
		height: 80rpx;
		border-radius: 5rpx;
	}

	.item_info {
		display: flex;
		justify-content: space-around;
		align-items: center;
		padding: 15rpx 0;
		border-bottom: 1rpx #ccc solid;
	}

	.nickName {
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		width: 50%;
	}
</style>
